package org.example.carousel.controller;

import org.example.carousel.service.CarouselService;
import org.example.model.common.Result;
import org.example.model.common.ResultCodeEnum;
import org.example.model.domain.Carousel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/carousel")
public class CarouselController {

    @Autowired
     CarouselService carouselService;

    @GetMapping("list")
    public Result<Carousel> list(){
        List<Carousel> carousel = carouselService.findCarousel();
        return Result.build(carousel, ResultCodeEnum.SUCCESS);
    }

}
